<script>
export default {
  // 全家变量
  globalData: {
    // 选择地址用
    selectAddress: null,
  },

  onLaunch() {
    // uni.getSystemInfo({
    //     success: (e) => {
    //         //   console.log('e.statusBarHeight',e.statusBarHeight);
    //         //   this.$message(e.statusBarHeight.toString());
    //         Vue.prototype.$systemInfo = e;
    //         Vue.prototype.$scale = this.$systemInfo.screenWidth / 375;
    //         this.getHeaderInfo(e);
    //     }
    // })
  },
  onShow() {
    // 同步用户数据
    // if (this.user) {
    //   userApi.userInfo().then(ret => {
    //     const user = {
    //       ...this.user,
    //       nickname: ret.data.nickname,
    //       mobile: ret.data.mobile,
    //       avatar: ret.data.avatar,
    //     }
    //     this.$store.commit('SET_USER', user);
    //   })
    // }
  },
  computed: {
    user() {
      return this.$store.state.user
    },
  },
  methods: {
    // 获取导航栏和状态栏高度
    getHeaderInfo(e) {
      // 状态栏高度
      let statusBarHeight = 0
      // 导航栏高度
      let headerBarHeight = 0

      // #ifndef MP
      statusBarHeight = e.statusBarHeight
      if (e.platform == 'android') {
        headerBarHeight = e.statusBarHeight + 50
      } else {
        headerBarHeight = e.statusBarHeight + 45
      }
      // #endif

      // #ifdef MP-WEIXIN
      statusBarHeight = e.statusBarHeight
      let custom = wx.getMenuButtonBoundingClientRect()
      Vue.prototype.Custom = custom
      headerBarHeight = custom.bottom + custom.top - e.statusBarHeight
      // #endif

      // #ifdef MP-ALIPAY
      statusBarHeight = e.statusBarHeight
      headerBarHeight = e.statusBarHeight + e.titleBarHeight
      // #endif

      Vue.prototype.appStatusBarHeight = statusBarHeight
      Vue.prototype.appHeaderBarHeight = headerBarHeight
    },
  },
}
</script>

<style lang="scss">
/*每个页面公共css */
// @import '@/scss/style.scss';
</style>
